<template>
    <div class="flex-main">
        <div class="flex-top">
            <menu-tabs class="mb" :menutab="menutab" @setMenutab="setMenutab"></menu-tabs>
        </div>
        <div class="flex-body">
            <no-data v-if="spellingList.length<1"></no-data>
            <div class="m-order-item mb" v-else 
                v-for="(item,index) in spellingList" :key="index"
                @click="toSpellingShare(item.id)">
                <div class="m-order-type">
                    <span>
                        <i v-if="item.state==0">待分享</i>
                        <i v-if="item.state==1">拼团成功</i>
                        <i v-if="item.state==2">拼团失败</i>，差{{item.number}}人
                    </span>
                </div>
                <div class="m-spellingitem">
                    <img :src="(item.Cover || require('@/assets/images/bg.png'))" alt="">
                    <div class="m-spellingdiv">
                        <p>{{item.ProjectName || '美业通项目'}}</p>
                        <div class="m-price">
                            <span>&yen;{{item.Price}}</span>
                        </div>
                    </div>
                    
                </div>
                <div class="m-order-right">
                    实付：&yen;498.00（含运费）
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import {customerSpelling} from '@/api/mine';
export default {
    name:'',
    data () {
        return {
            menutab:['待分享','拼团成功','拼团失败'],
            pageNo:1,
            state:0,
            spellingList:[],    //列表数据
            nolist:false,       //无数据
        }
    },
    components: {
        menuTabs:()=>import('@/components/menuTabs'),
        orderGoodsinfo:()=>import('@/model/mine/orderGoodsinfo'),
    },
    methods: {
        toSpellingShare(id) {
            this.$router.push({path:'/spellingShare',query:{id:id}});
        },
        // 选择tab事件
        setMenutab(index){
            if(index==2){
                this.state = -1;
            }else{
                this.state = index;
            }
            this.getSpelling();
        },
        // 获取我的拼团列表
        getSpelling() {
            this.$indicator.open('加载中...');
            let param = {
                page:this.pageNo,
                state:this.state,
                list_rows:10,
                customer_id:this.$utils.uid
            }
            customerSpelling(param).then(result=>{
                this.$indicator.close();
                this.spellingList = result.list.data;
            }).catch(error=>{
                this.$indicator.close();
            })
        }
    },
    created() {
        this.getSpelling();
    }
}
</script>
<style lang="less" scoped src="@/less/mine/myOrders.less">

</style>
